#include "skill.h"

const QString Skill::KEY_DEFAULT = "default";
const QString Skill::KEY_ACTION = "action";
const QString Skill::KEY_EFFORT = "effort";
const QString Skill::KEY_LEVEL = "level";

Skill::Skill(const QMap<QString, QString> &values)
    : XMLItem(values)
{
    Q_ASSERT(values.contains(KEY_DEFAULT));
    Q_ASSERT(values.contains(KEY_ACTION));
    Q_ASSERT(values.contains(KEY_EFFORT));
    Q_ASSERT(values.contains(KEY_LEVEL));

    _isDefault = values[KEY_DEFAULT];
    _action = values[KEY_ACTION];
    _effort = values[KEY_EFFORT];
    _level = Level(values[KEY_LEVEL]);
}

Skill::Skill()
  : XMLItem()
{
}

QString Skill::keyValue(const QString &key) const
{
    if (key == KEY_DEFAULT) return isDefault();
    if (key == KEY_ACTION) return action();
    if (key == KEY_EFFORT) return effort();
    if (key == KEY_LEVEL) return level();

    return XMLItem::keyValue(key);
}
